import networkx as nx
import matplotlib.pyplot as plt

G = nx.DiGraph()

G.add_nodes_from(['A', 'B', 'C', 'D', 'E'])
G.add_edge('A', 'B', capacity = 100)
G.add_edge('B', 'C', capacity = 0)
G.add_edge('C', 'D', capacity = 100)
G.add_edge('D', 'E', capacity = 0)

x = nx.minimum_cut(G, 'A', 'E')
print (x)
print (nx.maximum_flow(G, 'A', 'E'))
#print (set(dict(nx.shortest_path_length(G, target='E'))))